//
//  BKTableViewController.m
//  XPhoto
//
//  Created by baboy on 2019/2/20.
//  Copyright © 2019 baboy. All rights reserved.
//

#import "BKTableViewController.h"
#import <BKKit/BKKit.h>
#import "UIScrollView+x.h"

@interface BKTableViewController ()

@end

@implementation BKTableViewController
- (BKTableView *)tableView{
    if (!_tableView) {
        _tableView = ([[BKTableView alloc] initWithFrame:self.view.bounds style:self.tableStyle]);
        _tableView.autoresizingMask |= UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
        UIEdgeInsets contentOriginInset = UIEdgeInsetsZero;
        if (!self.navigationController.navigationBar.isHidden) {
            CGFloat statusBarHeight = [APP isStatusBarHidden]?0:[APP statusBarFrame].size.height;
            contentOriginInset.top = self.navigationController.navigationBar.bounds.size.height + statusBarHeight;
        }
        if (self.tabBarController && !self.hidesBottomBarWhenPushed) {
            contentOriginInset.bottom = self.tabBarController.tabBar.bounds.size.height;
        }
        [_tableView setDelegate:self];
        [_tableView setDataSource:self];
    }
    return _tableView;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (id)init{
    if(self = [super init]){
        self.tableStyle = UITableViewStylePlain;
    }
    return self;
}
- (void)reset{
    [super reset];
    self.tableView = nil;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 0;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return nil;
}
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
    [self.tableView scrollViewDidScroll];
}
-(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{
    [self.tableView scrollViewDidEndDragging];
}
@end
